<br/><?php echo $title; ?>&nbsp;<img src="/images/admin/okBut.png" width="20px" title="отметить все" id="selectPartners" style="cursor: pointer"/><br/>
<?php
$cats = array();
foreach ($res as $r) :
    if(!in_array($r['catName'], $cats)) $cats[] = $r['catName'];
endforeach; 
?>

<?php 
foreach($cats as $c) {
    $i = 0;
    echo '<div style="color:blue">'.$c.':</div>';
    foreach ($res as $r) { 
        if($r['catName'] == $c) {
            if(!++$i % 10) echo '<br/>';
            echo $r['name'];
            echo CHtml::checkBox($modelName.'[partners][]', false, array('value'=>$r['partnerid'].','.$r['catId'], 'style'=>'margin-right:15px', 'class'=>'listPartners'));
        }
    }
}
?>